library(data.table)
library(dplyr)
df=fread("H:/Zheng_10223/Joint/cohort_2025.csv")



df$refugeein=ifelse(df$ImmigrationCategory=="Refugee",1,0)



df$mainparent_college=ifelse(df$YEARS_OF_SCHOOLING_MainParent>12,1,0)
df$highskillmain=ifelse(df$SKILL_LEVEL_CD11_Main %in% c("0","A","B"),1,0)

model3=lm(MainParent_emig30yr ~ factor(mainparent_college)  + factor(AnyEnglish_Main) + factor(highskillmain ), data=df)
model3a=lm(MainParent_emig30yr ~ factor(mainparent_college) *factor(refugeein)  + factor(AnyEnglish_Main)*factor(refugeein) + factor(highskillmain)*factor(refugeein), data=df)

stargazer(model3,model3a,out="H:/Zheng_10223/ToVet/predict_emig30.tex")


model2=lm(MainParent_emig30yr ~ factor(mainparent_college)  + factor(AnyEnglish_Main) , data=df)
model2a=lm(MainParent_emig30yr ~ factor(mainparent_college) *factor(refugeein)  + factor(AnyEnglish_Main)*factor(refugeein) , data=df)


stargazer(model2,model2a,out="H:/Zheng_10223/ToVet/predict_emig30part2.tex")


